<!-- 预约车辆 - 预约车辆item -->
<template>
	<view>
		<block v-for="(item, index) in listData" :key="index">
			<view class="main-box-item" @click="clickItem(item)">
				<image class="box-img" v-if="item.cartype=='2'" src="/static/img/icon/icon_person.png" />
				<image class="box-img" v-else :src="item.carimage|getFirstImgFormat" />
				<view class="box-info">
					<view class="box-info-bottom">
						<view class="row1">
							<view class="option">
								<image class="" v-if="item.cartype=='2'" src="/static/img/icon/icon_captain.png" />
								<image class="" v-else src="/static/img/icon/icon_car.png" />
								{{(item.cartype=='2')?item.driver:(item.carcode||'')}}
							</view>
							<view class="status" :style="getRecordState(item.status).style">
								{{getRecordState(item.status).value}}
							</view>
						</view>
						<view class="row2">
							<image class="" src="/static/img/icon/icon_in.png" />
							进： <uni-dateformat :date="item.intime"></uni-dateformat>
						</view>
						<view class="row3">
							<image class="" src="/static/img/icon/icon_out.png" />
							出： <uni-dateformat :date="item.outtime"></uni-dateformat>
						</view>
						<view class="row3">
							<image class="" src="/static/img/icon/icon_local.png" />
							{{item.destination||''}}
						</view>
					</view>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	import {
		GetFirstImgFormat2
	} from "@/common/util-file.js"
	import {
		GetRecordState
	} from "@/common/util.js"

	export default {
		props: ['list'], //数据数组
		data() {
			return {
				listData: this.list,
			}
		},
		mounted() {},
		methods: {
			clickItem(item) {
				this.$emit('clickItem', item)
			},
			getRecordState(val) {
				return GetRecordState(val);
			}
		},
		filters: {
			getFirstImgFormat(files) {
				return GetFirstImgFormat2(files);
			}
		},
		watch: {
			list: {
				handler(item, index) { //监听到数据变化执行方法 
					this.listData = item;
				},
				deep: true // 深度监听父组件传过来对象变化 
			}
		}
	}
</script>

<style lang='scss'>
	.main-box-item {
		display: flex;
		align-items: center;
		width: calc(100% - 20px);
		height: 120px;
		background: #FFFFFF;
		/* box-shadow: 0px 2px 5px #F0F0F0; */
		/* border-radius: 4px; */
		vertical-align: middle;
		margin: 0px 10px;
		border-bottom-color: #E6E6E6;
		border-bottom-style: solid;
		border-bottom-width: 0.5px;
	}

	.box-img {
		width: 115px;
		height: 85px;
		border-radius: 4px;

	}

	.box-info {
		flex: 1;
		padding: 5px;
		margin-left: 10px;
		width: calc(100% - 160px);
	}

	.box-info-item {
		/* height: 60px; */
		background: #FFFFFF;
		border-top-color: #e5e5e5;
		border-top-style: solid;
		border-top-width: 0.5px;
		padding: 5px 3px;
	}

	.box-info-title {
		/* display: bloc; */
		height: 25px;
		font-size: 17px;
		font-weight: bold;
		/* 	overflow: hidden;
			text-overflow: ellipsis;
			display: -webkit-box;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 2; */
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.box-info-title .state-img {
		width: 18px;
		height: 18px;
		margin-right: 10px;
	}

	.box-info-bottom {
		display: flex;
		flex-direction: column;

		/* margin-top: 15px; */
		/* padding: 2px 8px 2px 16px; */
		image {
			width: 16px;
			height: 16px;
			margin-right: 6px;
		}

		.left {
			font-size: 12px;
			max-height: 2.5rem;
			line-height: 20px;
			width: 40px;
			/* box-shadow: 0px 2px 5px #E5E5E5; */
			border-radius: 2px;
			text-align: center;
		}

		.row1 {
			display: flex;
			align-items: center;
			/* background: rgba(89, 96, 128, 0.1); */
			border-radius: 2px;
			margin: 1px 0;
			font-size: 12px;
			font-family: FZLanTingHei-M-GBK;
			font-weight: 400;
			line-height: 12px;
			color: #596080;

			.option {
				flex: 1;
				display: flex;
				align-items: center;

			}

			.status {
				font-size: 22rpx;
				text-align: center;
				broder: 2rpx;
				border-width: 1rpx;
				border-style: solid;
				height: 38rpx;
				width: 80rpx;
				border-radius: 10rpx;
			}
		}

		.row2 {
			display: flex;
			align-items: center;
			font-size: 12px;
			font-weight: 400;
			line-height: 20px;
			color: #888888;
			margin: 1px 0;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
			flex: 0.5;
		}

		.row3 {
			display: flex;
			align-items: center;
			font-size: 12px;
			font-weight: 400;
			line-height: 20px;
			color: #888888;
			margin: 1px 0;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
			flex: 0.5;

			.right {
				flex: 1;
				text-align: right;
				font-size: 12px;
				font-weight: 400;
				line-height: 20px;
				color: #888888;

				.tit {
					width: 50px;
					float: right;
					text-align: center;
					/* border-radius: 50%; */
					border-radius: 100px;
					color: #ffffff;
				}
			}
		}
	}
</style>
